<?php
defined('IN_PHPCMS') or exit('No permission resources.');
$db = '';
$db = pc_base::load_model('picture_model');

$page = isset($_GET['page'])?intval($_GET['page']):1;
get_picture($page);

//获取瀑布流图书信息
function get_picture($page=1,$pagesize=4)
{
    global $db;
    $pagenow = ($page-1)<0?(1*$pagesize):($page-1)*$pagesize; //当前页

    $query = 'SELECT p.id,p.title,p.thumb,p.url,d.info FROM `'.$db->db_tablepre.'picture` p INNER JOIN `'.$db->db_tablepre.'picture_data` d ON p.id = d.id LIMIT '.$pagenow.','.$pagesize;
    $res = $db->query($query);
    $row = $db->fetch_array();
    /*echo '<pre>';
    print_r($row);
    exit();*/
    $str_html  = '';
    foreach($row as $key => $val)
    {
        $str_html .= '<div class="grid">';
        $str_html .= '<div class="imgholder"><a href="'.$row[$key][url].'" target="_blank"><img class="lazy" src="'.SKIN_PATH.'images/pixel.gif" data-original="'.thumb($row[$key][thumb],216,0).'" width="215" /></a></div>';
        $str_html .= '<strong><a href="'.$row[$key][url].'" target="_blank">'.$row[$key][title].'</a></strong>';
        $str_html .= '<p class="info">'.str_cut(strip_tags($row[$key][info]),100).'</p>';
        $str_html .= '<div class="meta"><a href="'.$row[$key][url].'" target="_blank">点击查看&gt;&gt;</a></div>';
        $str_html .= '</div>';
    }
    echo $str_html;
}
?>